package com.aaa.phone.controller.servicecontroller;

import com.aaa.phone.service.serviceservice.ServiceService;
import com.aaa.phone.systemconst.ISystemConst;
import com.aaa.util.IDCardUploadImg;
import com.aaa.util.PictureUtil;
import com.aaa.web.commons.Result;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.util.Base64;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;

/**
 * @description: 手机客服Controller层
 * @author: 王林林
 * @create: 2018/12/19 9:48
 **/
@RestController
@CrossOrigin
@RequestMapping("/service")
public class ServiceController {
    @Autowired
    private ServiceService service;

    /*xml文件根据type的值来判断是投诉还是建议并依此向数据库添加信息*/
    @RequestMapping("/addComplain")
    public int addComplain(String telephone, String complaintDesc, int type) {
        /*投诉和建议调用相同的service但建议并无上传图片*/
        String s = "";
        return service.addComplain(telephone, complaintDesc, s, type);
    }

    /**
     * 提交建议
     * @param telephone
     * @param info
     * @param imgUrl
     */
    @RequestMapping("/UploadAdvice")
    public int test(String telephone, String info, String imgUrl) {
        return service.addComplain(telephone, info, imgUrl, 1);
    }
}
